package com.lhn.service.impl;

import com.lhn.dao.BookDao;
import com.lhn.service.BookService;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

/**
 * @author lhn
 * @date 2024-08-16 16:44
 */

public class BookServiceImpl implements BookService, InitializingBean, DisposableBean {

    private BookDao bookDao;
    @Override
    public void save() {
        System.out.println("book service save ...");
        bookDao.save();
    }

    public void setBookDao(BookDao bookDao) {
        System.out.println("method setBookDao ...");
        this.bookDao = bookDao;
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("book service destroy ...");
    }


    //afterPropertiesSet() 方法是 Spring 框架中的一个回调方法，用于在所有 Bean 属性被设置后执行自定义初始化逻辑。
    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("book service init ...");
    }
}
